from PyQt4 import QtCore, QtGui;

class MenuCmds(QtCore.QObject):
    def __init__(self, parentWin, actionCmds):
        super(MenuCmds, self).__init__();
        self.parentWin = parentWin;
        self.actionCmds = actionCmds;
        self.createMenuCmds();
        
    
    def createMenuCmds(self):
        self.menubar = QtGui.QMenuBar(self.parentWin.mainWin);
        self.menuFile = QtGui.QMenu("File", self.menubar);
        self.menuEdit = QtGui.QMenu("Edit", self.menubar);
        self.menuView = QtGui.QMenu("Show", self.menubar);
        self.menuAlignNodes = QtGui.QMenu("Align", self.menubar);
#        self.menuGraph = QtGui.QMenu("Graph", self.menubar);
        self.menuData = QtGui.QMenu("Data", self.menubar);
        self.menuTable = QtGui.QMenu("Table", self.menuView);
#        self.menuStateInfo = QtGui.QMenu("State Info Style", self.menuView);
#        self.menuEdgeInfo = QtGui.QMenu("Edge Info Style", self.menuView);
#        self.menuActionInfo = QtGui.QMenu("Action Info Style", self.menuView);
#        self.menuGraphTheme = QtGui.QMenu("Graph Theme", self.menuGraph);
#        self.menuStatusType = QtGui.QMenu("Status Type", self.menuGraph);
#        self.menuSt_StatusType = QtGui.QMenu("State", self.menuStatusType);
#        self.menuAct_StatusType = QtGui.QMenu("Action", self.menuStatusType);
#        self.menuShapeStyle = QtGui.QMenu("Shape Style", self.menuGraph);
#        self.menuSt_ShapeStyle = QtGui.QMenu("State", self.menuShapeStyle);
#        self.menuEdge_ShapeStyle = QtGui.QMenu("Edge", self.menuShapeStyle);
#        self.menuGraphSettings = QtGui.QMenu("Set Graph Settings", self.menuGraph);
#        self.menuAlignNodes = QtGui.QMenu("Align State Nodes", self.menuGraph);
#        self.menuBuildGraph = QtGui.QMenu("Build Graph from...", self.menuData);
#        self.menuBuildGraph.setIcon(QtGui.QIcon('Images/buildGraph.png'));
#        self.menuGenerateTable = QtGui.QMenu("Generate tables...", self.menuData);
#        self.menuGenerateTable.setIcon(QtGui.QIcon('Images/build_Tables.png'));
#        self.menuStBkgColor = QtGui.QMenu("States Background Color", self.menuGraph);
#        self.menuActBkgColor = QtGui.QMenu("Actions Background Color", self.menuGraph);
        self.parentWin.mainWin.setMenuBar(self.menubar);
        
        #Set TearOff Feature On with all Menus
        self.menuEdit.setTearOffEnabled(True);
        self.menuView.setTearOffEnabled(True);
#        self.menuGraph.setTearOffEnabled(True);
        self.menuData.setTearOffEnabled(True);
        self.menuTable.setTearOffEnabled(True);
#        self.menuStateInfo.setTearOffEnabled(True);
#        self.menuEdgeInfo.setTearOffEnabled(True);
#        self.menuActionInfo.setTearOffEnabled(True);
#        self.menuGraphTheme.setTearOffEnabled(True);
#        self.menuStatusType.setTearOffEnabled(True);
#        self.menuSt_StatusType.setTearOffEnabled(True);
#        self.menuAct_StatusType.setTearOffEnabled(True);
#        self.menuShapeStyle.setTearOffEnabled(True);
#        self.menuSt_ShapeStyle.setTearOffEnabled(True);
#        self.menuEdge_ShapeStyle.setTearOffEnabled(True);
#        self.menuGraphSettings.setTearOffEnabled(True);
#        self.menuAlignNodes.setTearOffEnabled(True);
#        self.menuBuildGraph.setTearOffEnabled(True);
#        self.menuGenerateTable.setTearOffEnabled(True);
#        self.menuStBkgColor.setTearOffEnabled(True);
#        self.menuActBkgColor.setTearOffEnabled(True);        

        #Menu File     
        self.menuFile.addAction(self.actionCmds.actionNewGraph);
        self.menuFile.addSeparator();
#        self.menuFile.addAction(self.actionCmds.actionLoadProject);
        self.menuFile.addAction(self.actionCmds.actionLoadGraph);
        self.menuFile.addAction(self.actionCmds.actionLoadSettings);
        self.menuFile.addSeparator();
#        self.menuFile.addAction(self.actionCmds.actionSaveProject);
        self.menuFile.addAction(self.actionCmds.actionSaveGraphAs);
        self.menuFile.addAction(self.actionCmds.actionSaveGraph);        
        self.menuFile.addAction(self.actionCmds.actionSaveSettings);
        self.menuFile.addSeparator();
        self.menuFile.addAction(self.actionCmds.actionExit);
        
        #Menu Edit
        self.menuEdit.addAction(self.actionCmds.actionUndo);
        self.menuEdit.addAction(self.actionCmds.actionRedo);
#        self.menuEdit.addAction(self.actionCmds.actionEditNodeInfo);
#        self.menuEdit.addAction(self.actionCmds.actionEditEdgeInfo);
        self.menuEdit.addAction(self.actionCmds.actionAddNode);
        self.menuEdit.addAction(self.actionCmds.actionDelete);
        self.menuEdit.addAction(self.actionCmds.actionShowCtrlPts);
        self.menuEdit.addSeparator();
        self.menuEdit.addAction(self.actionCmds.actionSelectGraph);
        self.menuEdit.addAction(self.actionCmds.actionSelectNodes);
#        self.menuEdit.addAction(self.actionCmds.actionSelectNodesByDim);
        self.menuEdit.addAction(self.actionCmds.actionSelectActions);
        self.menuEdit.addAction(self.actionCmds.actionSelectEdges);
        
        #Menu View
        self.menuView.addAction(self.actionCmds.actionAnimateTrans);
        self.menuView.addAction(self.actionCmds.actionGraph);
        self.menuView.addAction(self.actionCmds.actionToolbar);
        self.menuView.addSeparator();
        self.menuView.addAction(self.actionCmds.actionFullScreen);
#        self.menuTable.addAction(self.actionCmds.actionTbl_MdpAndRisks);
#        self.menuTable.addAction(self.actionCmds.actionTbl_StateInfo);
#        self.menuTable.addAction(self.actionCmds.actionTbl_StateTrans);
#        self.menuTable.addAction(self.actionCmds.actionTbl_MdpTraceEv);
#        self.menuTable.addAction(self.actionCmds.actionTbl_GralMdpVals);
        self.menuView.addAction(self.actionCmds.actionZoomIn);
        self.menuView.addAction(self.actionCmds.actionZoomOut);
        self.menuView.addAction(self.actionCmds.actionZoomReset);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_AllInfo);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_HideV);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_HideR);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_OnlyR);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_OnlyV);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_OnlyDim);
#        self.menuStateInfo.addAction(self.actionCmds.actionSt_NoInfo);
#        self.menuEdgeInfo.addAction(self.actionCmds.actionEdge_AllInfo);
#        self.menuEdgeInfo.addAction(self.actionCmds.actionEdge_OnlyProb);
#        self.menuEdgeInfo.addAction(self.actionCmds.actionEdge_OnlyR);
#        self.menuEdgeInfo.addAction(self.actionCmds.actionEdge_NoInfo);
#        self.menuActionInfo.addAction(self.actionCmds.actionAct_OnlyQ);
#        self.menuActionInfo.addAction(self.actionCmds.actionAct_OnlyId);
#        self.menuActionInfo.addAction(self.actionCmds.actionAct_NoInfo);
#        self.menuView.addSeparator();
#        self.menuView.addAction(self.menuStateInfo.menuAction());
#        self.menuView.addAction(self.menuEdgeInfo.menuAction());
#        self.menuView.addAction(self.menuActionInfo.menuAction());
        self.menuView.addSeparator();
#        self.menuView.addAction(self.menuTable.menuAction());
        self.menuView.addAction(self.actionCmds.actionGraphSettings);
        
        #Menu Graph
#        self.menuGraph.addAction(self.actionCmds.actionAnimateTrans);
#        self.menuGraph.addSeparator();
#        self.menuGraph.addAction(self.actionCmds.actionLayoutGrid);
#        self.menuGraph.addAction(self.actionCmds.actionLayoutFlow);
#        self.menuGraph.addAction(self.actionCmds.actionLayoutCircle);
#        self.menuGraph.addAction(self.actionCmds.actionLayoutCurve);
#        self.menuGraph.addAction(self.menuAlignNodes.menuAction());
#        self.menuGraphTheme.addAction(self.actionCmds.actionThemeGeneric);
#        self.menuGraphTheme.addAction(self.actionCmds.actionThemeMaze);        
#        self.menuSt_StatusType.addAction(self.actionCmds.actionSt_Normal);
#        self.menuSt_StatusType.addAction(self.actionCmds.actionSt_Current);
#        self.menuSt_StatusType.addAction(self.actionCmds.actionSt_Goal);
#        self.menuSt_StatusType.addAction(self.actionCmds.actionSt_Fatal);
#        self.menuAct_StatusType.addAction(self.actionCmds.actionAct_Normal);
#        self.menuAct_StatusType.addAction(self.actionCmds.actionAct_Current);
#        self.menuAct_StatusType.addAction(self.actionCmds.actionAct_Best);
#        self.menuAct_StatusType.addAction(self.actionCmds.actionAct_Risky);    
#        self.menuSt_ShapeStyle.addAction(self.actionCmds.actionSt_Rect);
#        self.menuSt_ShapeStyle.addAction(self.actionCmds.actionSt_RoundedRect);    
#        self.menuSt_ShapeStyle.addAction(self.actionCmds.actionSt_Circle);
#        self.menuEdge_ShapeStyle.addAction(self.actionCmds.actionEdge_Spline);
#        self.menuEdge_ShapeStyle.addAction(self.actionCmds.actionEdge_Polygon);        
#        self.menuGraphSettings.addAction(self.actionCmds.actionMovable);
#        self.menuGraphSettings.addAction(self.actionCmds.actionSelectable);
#        self.menuStBkgColor.addAction(self.actionCmds.actionStBkgColor_None);
#        self.menuStBkgColor.addAction(self.actionCmds.actionStBkgColor_ByVal);
#        self.menuStBkgColor.addAction(self.actionCmds.actionStBkgColor_ByR);
#        self.menuStBkgColor.addAction(self.actionCmds.actionStBkgColor_ByDim);
#        self.menuActBkgColor.addAction(self.actionCmds.actionActBkgColor_None);
#        self.menuActBkgColor.addAction(self.actionCmds.actionActBkgColor_ByQ);
#        self.menuGraphSettings.addAction(self.actionCmds.actionActsFront);
#        self.menuGraphSettings.addAction(self.actionCmds.actionEdgesFront);
#        self.menuGraphSettings.addAction(self.menuStBkgColor.menuAction());
#        self.menuGraphSettings.addAction(self.menuActBkgColor.menuAction());
#        self.menuGraphSettings.addAction(self.actionCmds.actionHideActs);
#        self.menuGraphSettings.addAction(self.actionCmds.actionHideEdges);        
        self.menuAlignNodes.addAction(self.actionCmds.actionAlign_Left);
        self.menuAlignNodes.addAction(self.actionCmds.actionAlign_Right);
        self.menuAlignNodes.addAction(self.actionCmds.actionAlign_CenterH);
        self.menuAlignNodes.addAction(self.actionCmds.actionAlign_CenterV);
        self.menuAlignNodes.addAction(self.actionCmds.actionAlign_Top);
        self.menuAlignNodes.addAction(self.actionCmds.actionAlign_Bottom);
#        self.menuGraph.addSeparator();
#        self.menuGraph.addAction(self.menuGraphTheme.menuAction());
#        self.menuGraph.addAction(self.menuStatusType.menuAction());
#        self.menuGraph.addAction(self.menuShapeStyle.menuAction());
#        self.menuStatusType.addAction(self.menuSt_StatusType.menuAction());
#        self.menuStatusType.addAction(self.menuAct_StatusType.menuAction());
#        self.menuShapeStyle.addAction(self.menuSt_ShapeStyle.menuAction());
#        self.menuShapeStyle.addAction(self.menuEdge_ShapeStyle.menuAction());
#        self.menuGraph.addSeparator();
#        self.menuGraph.addAction(self.menuGraphSettings.menuAction());
        
        #Menu Data
        self.menuData.addAction(self.actionCmds.actionBuildGraph);
        self.menuData.addAction(self.actionCmds.actionGenerateTables);
        self.menuData.addSeparator();
        self.menuData.addAction(self.actionCmds.actionTbl_GrpActVals);
#         self.menuData.addAction(self.actionCmds.actionTbl_GralMdpVals);
#         self.menuData.addAction(self.actionCmds.actionTbl_MdpTraceEv);
# #         self.menuData.addAction(self.actionCmds.actionTbl_StateTrans);
# #         self.menuData.addAction(self.actionCmds.actionTbl_StateDists);
# #         self.menuData.addAction(self.actionCmds.actionTbl_StateInfo);
# #         self.menuData.addAction(self.actionCmds.actionTbl_MdpAndRisks);
# #         self.menuData.addAction(self.actionCmds.actionTbl_RiskActRes);
#        self.menuBuildGraph.addAction(self.actionCmds.actionBuildGraph_AllTables);
#        self.menuBuildGraph.addAction(self.actionCmds.actionBuildGraph_Transition);
#        self.menuBuildGraph.addAction(self.actionCmds.actionBuildGraph_StateDim);
#        self.menuBuildGraph.addAction(self.actionCmds.actionBuildGraph_StateInfo);
#        self.menuBuildGraph.addAction(self.actionCmds.actionBuildGraph_Rewards);
#        self.menuBuildGraph.addAction(self.actionCmds.actionBuildGraph_QValue);
#        self.menuGenerateTable.addAction(self.actionCmds.actionGenerateTable_AllTables);
#        self.menuGenerateTable.addAction(self.actionCmds.actionGenerateTable_Transition);
#        self.menuGenerateTable.addAction(self.actionCmds.actionGenerateTable_StateDim);
#        self.menuGenerateTable.addAction(self.actionCmds.actionGenerateTable_StateInfo);
#        self.menuGenerateTable.addAction(self.actionCmds.actionGenerateTable_Rewards );
#        self.menuGenerateTable.addAction(self.actionCmds.actionGenerateTable_QValue);
#        self.menuData.addAction(self.menuBuildGraph.menuAction());
#        self.menuData.addAction(self.menuGenerateTable.menuAction());
        
        #Adding Menus
        self.menubar.addAction(self.menuFile.menuAction());
        self.menubar.addAction(self.menuEdit.menuAction());
        self.menubar.addAction(self.menuView.menuAction());
#        self.menubar.addAction(self.menuGraph.menuAction());
        self.menubar.addAction(self.menuData.menuAction());
#        self.menubar.addAction(self.menuAlignNodes.menuAction());